package com.top.entiy;

import com.top.utils.FormatUtil;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 订单类
 */
public class Order {

    /**
     * 订单id
     */
    private Integer id;

    /**
     * 订单编号
     */
    private String sn;

    /**
     * 桌号
     */
    private Integer tableNo;

    /**
     * 订单状态
     */
    private Integer status;
    private String statusStr;



    public String getStatusStr() {
        if (status == 1) {
            statusStr = "新订单";
        } else if (status == 2) {
            statusStr = "已完成";
        }
        return statusStr;
    }

    /**
     * 订单总价
     */
    private BigDecimal amount;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 支付时间
     */
    private Date payTime;

    /**
     * 备注
     */
    private String remark;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    public Integer getTableNo() {
        return tableNo;
    }

    public void setTableNo(Integer tableNo) {
        this.tableNo = tableNo;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Date getPayTime() {
        return payTime;
    }

    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getColumn() {
        return FormatUtil.format(15, "ID", "订单编号", "桌号", "订单状态", "订单总价", "创建时间", "支付时间");
    }

    @Override
    public String toString() {
        statusStr = getStatusStr();
        return FormatUtil.format(15, id, sn, tableNo, statusStr, amount, createTime, payTime);
    }
}

